// pages/detail/detail.js
const {http} = require('../../utils/index')
Page({

    /**
     * 页面的初始数据
     */
    data: {
        name:"",
        imgUrl:"",
        description:""
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var {id} = options;
        var url = `http://47.108.197.28:3000/playlist/detail?id=${id}`;
        http({
            url,
            success:res=>{
                var {name,coverImgUrl,description} = res.data.playlist;
                this.setData({
                    name,
                    imgUrl:coverImgUrl,
                    description
                })
            }
        })
    }
})